package com.wyman.core.io;

import org.junit.Assert;

/**
 * @Author 李伟民
 * @Description
 * @DateTime 2024/12/6 01:30
 */
public class DefaultResourceLoader implements ResourceLoader{


    @Override
    public Resource getResource(String location) {

        Assert.assertNotNull(location,"location must be not null");

        if(location.startsWith(CLASSPATH_URL_PREFIX)){
            return new ClassPathResource(location.substring(CLASSPATH_URL_PREFIX.length()),null);
        }
        else{
            return new FileSystemResource(location);
        }
    }
}
